package com.wss.service.fegin.fallbackFactory;

import com.wss.common.model.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import com.wss.service.fegin.CodeService;


@Component
@Slf4j
public class CodeServiceFallbackFactory implements FallbackFactory<CodeService> {
    @Override
    public CodeService create(Throwable throwable) {

        return new CodeService() {
            @Override
            public Result validate(String email, String code) {
                log.error(throwable.getMessage(),throwable);
                return Result.fail(throwable.getMessage());
            }
        };
    }
}
